package org.fanjr.simplify.rest.factory;

import static org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_SINGLETON;

import org.fanjr.simplify.rest.utils.SimplifyMvcMappingUtil;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;

/**
 * 
 * @author fanjr@vip.qq.com
 * @since 20190222 10:29:28
 */
@Lazy(false)
@Scope(SCOPE_SINGLETON)
public class SimplifyRestSmartInitializing implements BeanFactoryAware, SmartInitializingSingleton {

	@Override
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		SimplifyMvcMappingUtil.setBeanFactory(beanFactory);
	}

	@Override
	public void afterSingletonsInstantiated() {
		SimplifyMvcMappingUtil.init();
	}
}
